Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Awattar: fetch more than 24h price data #16338

Merged
merged 2 commits into from
Sep 27, 2024
Merged

Conversation

andi0b
Copy link
Contributor

@andi0b andi0b commented Sep 26, 2024

Currently the Awattar API call is unparametrized, which fetches the price for the next 24 hours.

Awattar publishes the prices for the next day around noon, so up to 35 hours of price data can be availible. The Awattar API also supports fetching more than 24 hours by parametrizing the API call with start and end timestamps.

This change makes all future price data available to evcc. This is important if you plan a charge to finish on the next day in the evening.


before:
grafik

after:
grafik

@@ -62,8 +62,14 @@ func (t *Awattar) run(done chan error) {
for ; true; <-tick.C {
var res awattar.Prices

// Awattar publishes prices for next day around 13:00 CET/CEST, so up to 35h of price data are available
// To be on the safe side request a window of -2h and +48h, the API doesn't mind requesting more than available
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we round to hours and do we really need two hours back instead of start of current hour?

Copy link
Contributor Author

@andi0b andi0b Sep 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we need 2 hours, but it could mitigate potential edge cases, like some potential errors in the awattar api regarding daylight savings time. Requesting one entry less doesn't seem worth investigating potential edge cases.

Start time in the Awattar api is exclusive, requesting start=12:15 for example returns 13:00-14:00 as the first entry in the response.

Rounding would be possible, but I don't see the benefit, except of adding complexity.

The PR is open for your changes.

@andig andig added enhancement New feature or request devices Specific device support labels Sep 26, 2024
tariff/awattar.go Outdated Show resolved Hide resolved
@andig andig merged commit 4af2d19 into evcc-io:master Sep 27, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devices Specific device support enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants